package com.keti.controller;

import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.keti.Dao.ApplyReceiveDao;
import com.keti.DaoImpl.ApplyReceiveDaoImpl;
import com.keti.pojo.ApplyReceive;


/**
 * Servlet implementation class ApplyReceiveServlet
 */
@WebServlet("/ApplyReceiveServlet")
public class ApplyReceiveServlet extends HttpServlet {
	
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		request.setCharacterEncoding("utf-8");
		  response.setContentType("text/html;charset=utf-8");
		  int uid = Integer.parseInt(request.getParameter("uid"));
		  int count = Integer.parseInt(request.getParameter("count"));
		  String reason = request.getParameter("reason");
		  ApplyReceive ar = new ApplyReceive();
		 
		  ar.setUid(uid);
		  ar.setCount(count);
		  ar.setReason(reason);
		  ApplyReceiveDao ard = new ApplyReceiveDaoImpl();
		  ard.add(ar);
		  response.sendRedirect("/RecipientsSystem/jsp/Login.jsp");
	}

	
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
